#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QString fromer = "xxxxxx@qq.com";
    QString toer = "xxxxxx@qq.com";
    QString smtpserver = "smtp.qq.com";
    QString subject = "Test title ";
    QString mailmessage = "this is a test ";
    m_mailer = new jwsmtp::mailer(toer.toStdString().c_str(), fromer.toStdString().c_str(), subject.toStdString().c_str(), mailmessage.toStdString().c_str(), smtpserver.toStdString().c_str(), jwsmtp::mailer::SMTP_PORT, false);
    //mail_.setsender(fromer.toStdString().c_str());
    m_mailer->username(fromer.toStdString().c_str());
    m_mailer->password("xxxxxx");
    m_mailer->send();

    //m_mailer->operator();
    qDebug() << QString::fromStdString(m_mailer->response());
}

MainWindow::~MainWindow()
{
    if(m_mailer)
        delete m_mailer;
    delete ui;
}

